package com.qiyeji.real_estate.ProjectTask;

import com.qiyeji.real_estate.entity.projectPhase;
import com.qiyeji.real_estate.service.ProjectPhaseService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class UpdateModelState implements JavaDelegate {

    @Autowired
    ProjectPhaseService projectPhaseService;

    @Override
    public void execute(DelegateExecution execution) throws Exception {
        try {
            System.out.println("修改项目建模阶段状态为完成！");
            projectPhaseService.updateByPrimaryKey(new projectPhase(execution.getBusinessKey(), "建模", "完成"));
            System.out.println("修改项目渲染阶段状态为正在进行！");
            projectPhaseService.updateByPrimaryKey(new projectPhase(execution.getBusinessKey(), "渲染", "正在进行"));

        } catch (Exception e){
            e.printStackTrace();
        }

    }
}
